package com.zpark.service.impl;

import com.zpark.mapper.IUserMapper;
import com.zpark.pojo.Empty;
import com.zpark.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @PackageName: com.zpark.service.impl
 * @ClassName: UserServiceImpl
 * @Description:
 * @author: RZS
 * @date: 2022/9/8  16:41
 */
@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private IUserMapper userMapper;

    /**
     * 添加一个用户
     * @param empty 用户数据
     * @return 受影响的行数
     */
    @Override
    public Integer addEmpty(Empty empty) {
        return userMapper.insertEmpty(empty);
    }

    /**
     * 根据用户id删除用户数据
     * @param id 用户id
     * @return 受影响的行数
     */
    @Override
    public Integer removeEmptyById(Integer id) {
        return userMapper.deleteEmptyById(id);
    }

    /**
     * 根据用户id修改用户的信息
     * @param empty 用户数据
     * @return 受影响的行数
     */
    @Override
    public Integer changeEmptyById(Empty empty) {
        return userMapper.updateEmptyById(empty);
    }

    /**
     * 查询所有用户的数据
     * @return 用户列表数据
     */
    @Override
    public List<Empty> findAllEmpty() {
        return userMapper.selectAllEmpty();
    }
}
